const proxy = {
  'GET /api/user/:id': (req, res) => {
    return res.json({
      status: 'ok',
      data: {
        id: 1,
        username: 'kenny',
        sex: 6,
      },
    });
  },
  'GET /api/user/list': [
    {
      id: 1,
      username: 'kenny',
      sex: 6,
    }, {
      id: 2,
      username: 'kenny',
      sex: 6
    }
  ],
  'POST /api/login': (req, res) => {
    const { password, username } = req.body;
    if (password === '1' && username === '99990001') {
      return res.json({
        status: 'ok',
        code: 0,
        data: {
          id: '99990001',
          username: 'admin'
        }
      });
    } else {
      return res.status(403).json({
        status: 'error',
        code: 403,
        message: '用户名或密码错误'
      });
    }
  },
  'DELETE /api/user/:id': (req, res) => {
    res.send({ status: 'ok', message: '删除成功！' });
  },
  'POST /api/menu': (req, res) => {
    const { id } = req.body;
    if (id === '99990001') {
      return res.json([
        {
          id: '1',
          name: '首页',
          bpid: '1',
          icon: 'home',
          route: '/home',
        },
        {
          id: '2',
          bpid: '1',
          icon: 'code-o',
          name: '样例',
          route: '/demo'
        },
        {
          id: '21',
          mpid: '2',
          bpid: '2',
          name: '评论 App',
          icon: 'message',
          route: '/demo/comment-app'
        },
        {
          id: '22',
          mpid: '2',
          bpid: '2',
          name: '用户管理',
          icon: 'user',
          route: '/demo/users',
        }, {
          id: '221',
          mpid: '-1',
          bpid: '3',
          name: '用户明细',
          route: '/demo/user/:id',
        }, {
          id: '3',
          name: 'SVG',
          route: '/svg',
          icon: 'chart',
        }, {
          id: '31',
          mpid: '3',
          bpid: '2',
          name: '柱状图',
          route: '/svg/bars',
        }, {
          id: '32',
          mpid: '3',
          bpid: '2',
          name: '条形图',
          route: '/svg/line',
        },
      ]);
    } else {
      return res.json([{
        id: '1',
        name: '首页',
        bpid: '1',
        icon: 'home',
        route: '/home',
      }]);
    }
  },
}
module.exports = proxy;
